package com.vic.designpattern.patterns.c_behavioral.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * 抽象聚合类
 * @author victor
 */
public class StudentAggregateImpl implements StudentAggregate {

    List<Student> list = new ArrayList<>();

    @Override
    public void addStudent(Student s) {
        list.add(s);
    }

    @Override
    public void removeStudent(Student s) {
        list.remove(s);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(list);
    }
}
